/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.psdk;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import com.qihoo.psdk.local.QBootReceiver;
import com.qihoo.psdk.local.QLocalService;
import com.qihoo.psdk.util.h;
import java.util.Set;

public class QPushAgent {
    private static final String TAG = "QPushAgent";
    private static Context ctx = null;

    public static void init(Context paramContext) {
        try {
            if (ctx == null) {
                ctx = paramContext;
                ctx.startService(new Intent(ctx, QLocalService.class));
            }
            if (QBootReceiver.a)
                return;
            Log.d("QPushAgent", "-->\"360 push registerId\": " + getRegisterId(ctx));
            a.b(paramContext);
            Intent localIntent = new Intent(ctx, QLocalService.class);
            localIntent.setAction("checkRemoteBind");
            paramContext.startService(localIntent);
        } catch (Exception localException) {
            h.a("QPushAgent", localException);
        }
    }

    public static void setAlias(Context paramContext, String paramString) {
        if (TextUtils.isEmpty(paramString))
            return;
        com.qihoo.psdk.app.a.a(paramContext, paramString);
    }

    public static void setTags(Context paramContext, Set paramSet) {
        if ((paramSet == null) || (paramSet.size() <= 0))
            return;
        com.qihoo.psdk.app.a.a(paramContext, paramSet);
    }

    public static void setTagsAndAlias(Context paramContext, String paramString, Set paramSet) {
        setAlias(paramContext, paramString);
        setTags(paramContext, paramSet);
    }

    public static String getRegisterId(Context paramContext) {
        String str1 = com.qihoo.psdk.util.a.a(paramContext, "QHOPENSDK_APPID");
        String str2 = com.qihoo.psdk.util.a.a(paramContext, str1, paramContext.getPackageName());
        return str2;
    }

    public static String getAppId(Context paramContext) {
        return com.qihoo.psdk.util.a.a(paramContext, "QHOPENSDK_APPID");
    }

    public static String sendPost(Context paramContext, String paramString) {
        String str = com.qihoo.psdk.remote.n.a();
        return e.b(paramContext, str, paramString);
    }

    public static void getStatus(Context paramContext) {
        try {
            com.qihoo.psdk.util.a.b(paramContext, "get_status", "");
        } catch (Exception localException) {
            h.a("QPushAgent", localException);
        }
    }

    public static void enable(Context paramContext) {
        n.a(paramContext, true);
    }

    public static void disable(Context paramContext) {
        n.a(paramContext, false);
    }

    public static boolean set360Qid(String paramString1, String paramString2) {
        int i = 0;
        if ((n.p().equals(paramString2)) && (paramString1 != null)) {
            k.b = paramString1;
            i = 1;
        }
        return i;
    }
}